package com.sunny.converter;

import com.sunny.dataobject.OrderMaster;
import com.sunny.dto.OrderDTO;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

/**
 * Created by dell on 2018/3/30.
 */
public class OrderMaster2OrderDTOConverter {
    private static OrderDTO convert(OrderMaster orderMaster){
        OrderDTO orderDTO=new OrderDTO();
        BeanUtils.copyProperties(orderMaster,orderDTO);
        return orderDTO;
    }

    public static List<OrderDTO> convert(List<OrderMaster> orderMasterList){
        return orderMasterList
                .stream()
                .map(e-> convert(e))
                .collect(Collectors.toList());
    }

}
